package com.fudan.tool;

import java.util.HashMap;
import java.util.Map;

import org.springframework.util.StringUtils;

public class IdHelper {

	private static Map<String, Integer> idMap = new HashMap<String, Integer>();

	public static final Integer generateId(String entityName) {
		if (!StringUtils.isEmpty(entityName)) {
			Integer count = idMap.get(entityName);
			if (count == null) {
				count = 1;
			} else {
				count++;
			}
			idMap.put(entityName, count);
		}
		return idMap.get(entityName);
	}
	
	public static final Integer getCurrentId(String entityName){
		return idMap.get(entityName);
	}

}
